
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.Signature;
import android.util.Log;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class SmaliHook extends Activity
{
  private static boolean DEBUG = false;//s 0;
  private static boolean DUMP_STACK =false;//s  0;
  private static String LOG_TAG = "lohan";

  public static void DumpStackIfWeShould()
  {
    if (!DUMP_STACK)
      return;
    StackTraceElement[] arrayOfStackTraceElement = Thread.currentThread().getStackTrace();
    String str1 = "Stack trace:\n";
    int i = 4;
    while (true)
    {
      int j = arrayOfStackTraceElement.length;
      if (i >= j)
      {
        int k = Log.d(LOG_TAG, str1);
        break;
      }
      String str2 = String.valueOf(str1);
      StringBuilder localStringBuilder = new StringBuilder(str2).append("  ");
      String str3 = arrayOfStackTraceElement[i].toString();
      str1 = str3 + "\n";
      i += 1;
    }
  }

  public static int checkSignatures()
  {
    //if (DEBUG)
      //int i = Log.d(LOG_TAG, "checkSignatures returning true");
    DumpStackIfWeShould();
    return 0;
  }

  public static int checkSignatures(String paramString1, String paramString2)
  {
    //if (DEBUG)
      //int i = Log.d(LOG_TAG, "checkSignatures returning true");
    DumpStackIfWeShould();
    return 0;
  }

  public static int getApplicationEnabledSetting(PackageManager paramPackageManager, String paramString)
  {
    try
    {
      int i = paramPackageManager.getApplicationEnabledSetting(paramString);
      int j = i;
      if (j == 2)
        j = 0;
      if (DEBUG)
      {
        String str1 = LOG_TAG;
        String str2 = "enabledSetting returning " + j;
        int k = Log.d(str1, str2);
      }
      DumpStackIfWeShould();
      return j;
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      //while (true)
        //int j = 0;
    }
	return 0;
  }

  public static String getInstallerPackageName(String paramString)
  {
    if (DEBUG)
    {
      String str1 = LOG_TAG;
      String str2 = "getInstallerPackageName returning " + "com.google.android.feedback";
      int i = Log.d(str1, str2);
    }
    DumpStackIfWeShould();
    return "com.google.android.feedback";
  }

  public static PackageInfo getPackageInfo(PackageManager paramPackageManager, String paramString, int paramInt)
    throws PackageManager.NameNotFoundException
  {
    try
    {
      PackageInfo localPackageInfo1 = paramPackageManager.getPackageInfo(paramString, paramInt);
      PackageInfo localPackageInfo2 = localPackageInfo1;
      if ((paramInt & 0x40) == 64)
      {
    	  
    	  Signature[] arrayOfSignature1 = spoofSignatures();
        int i = 0;
        int j = localPackageInfo2.signatures.length;
        if (i >= j)
        {
          if (DEBUG)
          {
            String str1 = LOG_TAG;
            String str2 = "spoofing signatures for " + paramString;
            int k = Log.d(str1, str2);
          }
          DumpStackIfWeShould();
        }
        return localPackageInfo2;
      }
      else
      {
        return localPackageInfo2;
      }
    }
    catch (PackageManager.NameNotFoundException localNameNotFoundException)
    {
      while (true)
      {
        Signature[] arrayOfSignature1;
        int i;
        if ((!paramString.toLowerCase().contains("pro")) && (!paramString.toLowerCase().contains("full")) && (!paramString.toLowerCase().contains("donate")) && (!paramString.toLowerCase().endsWith("key")))
          throw new PackageManager.NameNotFoundException();
        PackageInfo localPackageInfo2 = paramPackageManager.getPackageInfo("com.ideashower.readitlater.pro", paramInt);
        continue;
        //Signature[] arrayOfSignature2 = localPackageInfo2.signatures;
        //Signature localSignature = arrayOfSignature1[i];
        //arrayOfSignature2[i] = localSignature;
        //i += 1;
      }
    }
  }

  public static Object invokeHook(Method paramMethod, Object paramObject, Object[] paramArrayOfObject)
    throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, PackageManager.NameNotFoundException
  {
    int i = 1;
    String str1 = paramMethod.getName();
    String str2;
    String str3;
    int k;
    Object localObject1;
    //label76: 
    	//label111: 
    		String str4;
    if (paramObject != null)
    {
      str2 = paramObject.getClass().getName();
      if (DEBUG)
      {
        str3 = "Invoke Hook: " + str2 + "." + str1 + "(";
        //if (paramArrayOfObject == null)
          //break label635;
        int j = paramArrayOfObject.length;
        k = 0;
        localObject1 = "";
        //if (k < j)
          //break label205;
        //if (((String)localObject1).length() <= 2)
          //break label628;
        int m = ((String)localObject1).length() - 2;
        String localObject2 = ((String)localObject1).substring(0, m);
        str4 = String.valueOf(str3);
      }
    }
    //label205: label628: label635: for (Object localObject2 = str4 + (String)localObject2; ; localObject2 = str3)
    {
      String str5 = LOG_TAG;
      String str6 = "";//String.valueOf(localObject2);
      String str7 = str6 + ")";
      int n = Log.d(str5, str7);
      DumpStackIfWeShould();
      if (1 == 0)
        paramMethod = (Method) paramMethod.invoke(paramObject, paramArrayOfObject);
      while (true)
      {
        return paramMethod;
      }
      //localObject2 = localObject1;
      //break label111;
    }
  }

  public static long lastModified(File paramFile)
  {
    long l = Long.parseLong("1300510609576");
    if (DUMP_STACK)
      Thread.dumpStack();
    if (!shouldSpoofFileInfo(paramFile))
    {
      l = paramFile.lastModified();
      if (DEBUG)
      {
        String str1 = LOG_TAG;
        StringBuilder localStringBuilder = new StringBuilder("spoofing file modified of ");
        String str2 = paramFile.getName();
        String str3 = str2 + " with " + l;
        int i = Log.d(str1, str3);
      }
      DumpStackIfWeShould();
    }
    return l;
  }

  public static long length(File paramFile)
  {
    long l = Long.parseLong("1029327");
    if (!shouldSpoofFileInfo(paramFile))
    {
      l = paramFile.length();
      if (DEBUG)
      {
        String str1 = LOG_TAG;
        StringBuilder localStringBuilder = new StringBuilder("spoofing file length of ");
        String str2 = paramFile.getName();
        String str3 = str2 + " with " + l;
        int i = Log.d(str1, str3);
      }
      DumpStackIfWeShould();
    }
    return l;
  }

  private static boolean shouldSpoofFileInfo(File paramFile)
  {
    int i = 0;
    if (paramFile.exists())
      i = 0;
    if (paramFile.getName().contains("com.ideashower.readitlater.pro"))
      i = 1;
    //return i;
    return true;
  }

  public static Signature[] spoofSignatures()
  {
    int i = Integer.parseInt("336");
    Signature[] arrayOfSignature = new Signature[i];
    int j = 0;
    while (true)
    {
      if (j >= i)
        return arrayOfSignature;
      Signature localSignature = new Signature("30820261308201caa00302010202044d77b48c300d06092a864886f70d01010505003074310b3009060355040613025553310b3009060355040813025749311630140603550407130d5768697465666973682042617931163014060355040a130d52656164204974204c617465723110300e060355040b1307416e64726f6964311630140603550403130d52656164204974204c617465723020170d3131303330393137313033365a180f33303130303731303137313033365a3074310b3009060355040613025553310b3009060355040813025749311630140603550407130d5768697465666973682042617931163014060355040a130d52656164204974204c617465723110300e060355040b1307416e64726f6964311630140603550403130d52656164204974204c6174657230819f300d06092a864886f70d010101050003818d0030818902818100a07e3921fab8e4549604111402dcf60d2605f68bbf02bc5510889cd383e8311acd159744a06f9485e95a701a123fdcdf635eb4d78a9047092a342d8307c2324714e590d1fcdff4a39d38897842ef3606f98f897bb155a9e0a3ddf95f55cc163692be484b17e50a5e6b107d79f626f661fc56760ad5c4e97e165e80a28a34f1c30203010001300d06092a864886f70d01010505000381810001026b15876a4e41f74b9eb7a2340c3b5e5520a7af1ca303c8bb01ce122da9a045de7640b5e573e80df869b086257950109c60f65bd130d4ef6fc5d3f0020eb71d4b35608e7b640de25dc14eab5f93cfd578d35d897d2f9c647e7e4e93bdd5d74edaeac5eeddde7b8fa065aba60570ec46167f98e5d41bd4eed5f7c14eb34a7a");
      arrayOfSignature[j] = localSignature;
      j += 1;
    }
  }
}

/* Location:           E:\AndroidDecompiler\jd-gui-0.3.3.windows\newrclasses.dex.dex2jar.jar
 * Qualified Name:     SmaliHook
 * JD-Core Version:    0.6.0
 */